<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE>Readme for hello example</TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.0  (Linux)">
	<META NAME="CREATED" CONTENT="20061007;13053000">
	<META NAME="CHANGEDBY" CONTENT="kejin">
	<META NAME="CHANGED" CONTENT="20070602;11470100">
	<STYLE TYPE="text/css">
	<!--
		@page { size: 8.5in 11in }
		P { color: #000000 }
		H2 { color: #000000 }
		H3 { color: #000000 }
		PRE { color: #000000 }
		A:link { color: #0000ff }
		A:visited { color: #990066 }
	-->
	</STYLE>
</HEAD>
<BODY LANG="en-US" TEXT="#000000" LINK="#0000ff" VLINK="#990066" BGCOLOR="#ffffff" DIR="LTR">
<H2>PocoCapsule/C++ example: &lt;on-error&gt; binary branching</H2>
<P>Copyright(c) 2006, 2007 by <A HREF="http://www.pocomatic.com/">Pocomatic
Software</A>. All rights reserved.</P>
<P>This example illustrates the usage of the binary branching element
&lt;on-error&gt;. 
</P>
<H3>Source Files</H3>
<P><A HREF="main.C">main.C:</A> This is a simple mini container, used
to deploy the example application. 
</P>
<P><A HREF="foo.h">foo.h</A> and <A HREF="foo.C">foo.C:</A> The
application logic bean component implementation. The factory method
Foo::create(int id) returns NULL for id &lt;= 0, to simulate an error
condition. 
</P>
<P><A HREF="setup.xml">setup.xml:</A> This is the application setup
description. It instantiates two beans using the Foo::create(int id)
method. The first one with negative id (-100). By the implementation
of Foo::create(int id) in the foo.C, this is going to return a NULL
bean. This should trigger the declared &lt;on-error&gt; IoC method
and ignore all post-instantiation &lt;ioc&gt; methods. The second
bean is instantiated with id 100, and it should succeed. In this
case, the declared &lt;on-error&gt; method will be ignored, and all
post-instantiation &lt;ioc&gt; methods will be performed afterwards. 
</P>
<H3>Building this example</H3>
<P STYLE="font-weight: medium">To build this example, the environment
variable POCOCAPSULE_DIR should point to the PocoCapsule/C++
installed directory. Then, this example can be built by simply
invoking gmake/make on linux/unix or nmake on windows. 
</P>
<H3>Running this example</H3>
<P><FONT FACE="Symbol">&middot; </FONT><FONT FACE="Times New Roman">Before
starting the application deployment container (i.e. the main
executable), make sure the LD_LIBRARY_PATH (on linux and solaris) or
the PATH (on windows) environment variable is set correctly to
include the ${POCOCAPSULE_DIR}/lib directory.</FONT></P>
<P><FONT FACE="Symbol">&middot; </FONT><FONT FACE="Times New Roman">start
the main executable: </FONT>
</P>
<PRE STYLE="margin-left: 0.79in; margin-bottom: 0.2in"><B>prompt&gt;</B> main </PRE><P STYLE="margin-bottom: 0.2in">
<FONT FACE="Times New Roman">It will print out the following result:</FONT></P>
<PRE STYLE="margin-left: 0.79in">on-error: Foo::create(-100)
Foo of id 100 okay!</PRE><P STYLE="margin-bottom: 0.2in">
<A HREF="../../README.html">Back to the root page</A></P>
</BODY>
</HTML>
